/*
 * xdma_lib.h
 *
 *  Created on: Jan 6, 2000
 *      Author: root
 */

#ifndef XDMA_LIB_H_
#define XDMA_LIB_H_


typedef struct InputInfoMsg {
	int pipeNum;
	void* src[6];
	int tsize;
	int flag;
} inputmsg;

extern int xdma_fiberLength[6];
extern int xdma_k_count[12];
extern int xdma_fpga_version;
extern int xdma_tongbu;

int sync_xdma_main(int coreindex);
void sync_exitXdma();
void  sync_bslWaitInputData();
int sync_bslGetInputData(void* msg);

int sync_xdma_drvsend(void *srcAddr,unsigned int size,int flag);

int sync_reset_xdma();
int sync_start_xdma();
int sync_stop_xdma();
int sync_set_fiberNum(int num,int time);
int sync_set_intSrc(int index);

#if 0
//this is an example for recv data
void recvtest()
{
	struct InputInfoMsg lmsgInfo;
	u32 *pSrc;
	int i=0;
	unsigned int fiberNum;
	int control_flag=0;

	while(1)
	{
		sync_bslWaitInputData();
		while(sync_bslGetInputData((struct InputInfoMsg *)&lmsgInfo))
		{
			fiberNum = lmsgInfo.pipeNum;
			control_flag=lmsgInfo.flag;
			if(control_flag==1)
			{
				pSrc = (u32*)lmsgInfo.src[0];
				//printf("Header-%x,at %p,len %x\n",pSrc[0],pSrc,lmsgInfo.tsize);
			}
			else
			{
				//printf("recvtest:%x\n",fiberNum);
				for(i=0;i<6;i++)
				{
					if(((1<<i)&fiberNum)!=0)
					{
						pSrc = (u32*)lmsgInfo.src[i];
//						printf("chn-%d,at %p,len %x\n",i,pSrc,lmsgInfo.tsize);
					}

				}
			}
		}
	}
}

#endif

#endif /* XDMA_LIB_H_ */
